//
//  NSTimer+ILGLib.m
//  ILGDemo
//
//  Created by happy on 2020/3/25.
//  Copyright © 2020 Happy. All rights reserved.
//

#import "NSTimer+ILGLib.h"

@implementation NSTimer (ILGLib)

+ (NSTimer *)ilg_scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer * _Nonnull))block
{
    return [NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(p_timerEvent:) userInfo:[block copy] repeats:repeats];
}

+ (void)p_timerEvent:(NSTimer *)timer
{
    void(^block)(NSTimer * _Nonnull timer) = timer.userInfo;
    
    if (block) {
        block(timer);
    }
}

@end
